package com.ruoyi.product.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.db.domain.ProductProfit;
import com.ruoyi.db.mapper.ProductProfitMapper;
import com.ruoyi.db.model.excle.ProductProfitAddupExcel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.ProductProfitAddupMapper;
import com.ruoyi.db.domain.ProductProfitAddup;
import com.ruoyi.product.service.IProductProfitAddupService;
import com.ruoyi.common.core.text.Convert;

/**
 * profitAddupService业务层处理
 * 
 * @author ruoyi
 * @date 2022-08-31
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class ProductProfitAddupServiceImpl implements IProductProfitAddupService 
{
    @Autowired
    private ProductProfitAddupMapper productProfitAddupMapper;
    @Autowired
    private ProductProfitMapper productProfitMapper;

    /**
     * 查询profitAddup
     * 
     * @param id profitAddup主键
     * @return profitAddup
     */
    @Override
    public ProductProfitAddup selectProductProfitAddupById(String id)
    {
        return productProfitAddupMapper.selectProductProfitAddupById(id);
    }

    /**
     * 查询profitAddup列表
     * 
     * @param productProfitAddup profitAddup
     * @return profitAddup
     */
    @Override
    public List<ProductProfitAddupExcel> selectProductProfitAddupList(ProductProfitAddup productProfitAddup)
    {
        return productProfitAddupMapper.selectProductProfitAddupList(productProfitAddup);
    }

    /**
     * 查询profitAddup列表
     *
     * @param productProfitAddup profitAddup
     * @return profitAddup
     */
    @Override
    public List<Map<String, Object>> selectProductProfitAddupQIVListMap(ProductProfitAddup productProfitAddup)
    {
        return productProfitAddupMapper.selectProductProfitAddupQIVListMap(productProfitAddup);
    }
    @Override
    public List<Map<String, Object>> selectProductProfitAddupListMap(ProductProfitAddup productProfitAddup)
    {
        return productProfitAddupMapper.selectProductProfitAddupListMap(productProfitAddup);
    }

    @Override
    public List<Map<String, Object>> selectProductProfitAddupTotalListMap(String profitId)
    {
        ProductProfit productProfit = productProfitMapper.selectProductProfitById(profitId);
        return productProfitAddupMapper.selectProductProfitAddupTotalListMap(productProfit.getDateInfo(), productProfit.getProductId());
    }

    /**
     * 新增profitAddup
     * 
     * @param productProfitAddup profitAddup
     * @return 结果
     */
    @Override
    public int insertProductProfitAddup(ProductProfitAddup productProfitAddup)
    {
        productProfitAddup.setCreateTime(DateUtils.getNowDate());
        return productProfitAddupMapper.insertProductProfitAddup(productProfitAddup);
    }

    /**
     * 修改profitAddup
     * 
     * @param productProfitAddup profitAddup
     * @return 结果
     */
    @Override
    public int updateProductProfitAddup(ProductProfitAddup productProfitAddup)
    {
        return productProfitAddupMapper.updateProductProfitAddup(productProfitAddup);
    }

    /**
     * 批量删除profitAddup
     * 
     * @param ids 需要删除的profitAddup主键
     * @return 结果
     */
    @Override
    public int deleteProductProfitAddupByIds(String ids)
    {
        return productProfitAddupMapper.deleteProductProfitAddupByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除profitAddup信息
     * 
     * @param id profitAddup主键
     * @return 结果
     */
    @Override
    public int deleteProductProfitAddupById(String id)
    {
        return productProfitAddupMapper.deleteProductProfitAddupById(id);
    }

    @Override
    public List<Map<String, Object>> selectProUvCountListMap(ProductProfitAddup productProfitAddup) {
        return productProfitAddupMapper.selectProUvCountListMap(productProfitAddup);
    }

    @Override
    public List<Map<String, Object>> selectProfitaddup(Long uid) {
        return productProfitAddupMapper.selectProfitaddup(uid);
    }
}
